﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenFaq.AcceptanceTests.StepHelpers;
using TechTalk.SpecFlow;
using WatiN.Core;

namespace OpenFaq.AcceptanceTests.Steps
{
    [Binding]
    public class PageReader
    {

		[Then("I should see a link with the text \"(.*)\" on the page")]
		public void ThenIShouldSeeALinkWithTheTextOnThePage(string linkText)
		{
			Assert.IsTrue(WebBrowser.Current.Link(Find.ByText(linkText)).Exists,
				string.Format("The following link text was not found on the page: {0}", linkText));
		}


		[Then("I should see a validation summary \"(.*)\"")]
		public void ThenIShouldSeeAValidationSummary(string validationSummary)
		{
			Assert.IsTrue(WebBrowser.Current.ContainsText(validationSummary),
				string.Format("The following validation summary text was not found on the page: {0}", validationSummary));

		}

		[Then("I should see a field error \"(.*)\"")]
		public void ThenIShouldSeeAFieldError(string fieldError)
		{
			Assert.IsTrue(WebBrowser.Current.ContainsText(fieldError),
				string.Format("The following validation summary text was not found on the page: {0}", fieldError));
		}

    }
}